home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / mebbs / yahtzee.lha / yatz / yahtzee.rexx < prev   
OS/2 REXX Batch file  |  1994-06-05  |  22KB  |  814 lines

  1. /* Yahtzee Version 1.1, original Starnet code by Cameron Arnott.  Improved by
  2.    Larry Cloud and Ed Kolar.  Converted to MEBBSNET Arexx by Larry Cloud.     */
  3.  
  4. signal on ERROR
  5. parse arg LineNumber
  6. options results
  7. DoorName = "Yahtzee"
  8. author = "Larry Cloud"
  9. if( ~show( 'l', "mebbsarexx.library" ) )then do
  10.    if( ~addlib( "mebbsarexx.library", 0, -30, 0 ) )then do
  11.       say "Could not open library"
  12.       exit 10
  13.    end
  14. end
  15.  
  16. call GetVar DoorName,LineNumber,1
  17. username = result
  18. version = "v1.1"         /* This version - Please don't change  */
  19. if ~show('L','rexxsupport.library') then do
  20. if addlib('rexxsupport.library',0,-30,0) then nop
  21. else do
  22. exit 10
  23. end
  24. end
  25. bbsname   = "Kitt's Korner BBS"
  26. sysopname = 'Keith Kittlesen'
  27. maxplays = 6;plays = 0
  28. file1  = 'doors:yatz/scores'       /*  high scores file. To reset just delete the file in BUL: */
  29. file2  = "doors:yatz/title"   /* path for yatz */
  30. file3  = "doors:yatz/instructions.gr1" /* Path for  instructions.gr1 */
  31. file13 = 'Doors:yatz/ErrorLog'/*  A copy of the errors so that the sysop can fix or report them to the author */
  32. file5  = 'doors:yatz/lastplayer' 
  33. file99 = 'bulletins:bul15.txt' /* A REAL bulletin instead of the scores file. */
  34. rer = 0;rnd=random(1,99,time('s'))
  35. file4 = 'doors:yatz/inuse'
  36. call getvar doorname,linenumber,8
  37. Graphic=result
  38. call getvar doorname,linenumber,9
  39. Width=result
  40. call getvar doorname,linenumber,10
  41. Rows=result
  42. call getvar doorname,linenumber,14
  43. BbsPath=result
  44. call getvar doorname,linenumber,15
  45. DoorsPath=result
  46. call getvar doorname,linenumber,16
  47. TextPath=result
  48. call getvar doorname,linenumber,20
  49. Access=result
  50. call getvar doorname,linenumber,21
  51. Handle=result
  52. sk=0
  53. if ~show('L','rexxsupport.library') then do
  54.     if addlib('rexxsupport.library',0,-30,0) then nop
  55.     else do
  56.     say 'support library not available'
  57.     exit 10
  58.     end
  59. end
  60. if (graphic = '0') then do
  61. call blank
  62. string= 'Whoops,  sorry but you will need COLOR & GRAPHICS to play Yahtzee.'
  63. call output
  64. call SHUTDOWN
  65. end
  66. CLS    = 'H'
  67. CLR    = ''
  68. CLL    = ''
  69. HOM    = 'H'
  70. OFF    = ''
  71. PENBLA = ''
  72. PENRED = ''
  73. PENGRE = ''
  74. PENYEL = ''
  75. PENBLU = ''
  76. PENPUR = ''
  77. PENCYA = ''
  78. PENWHI = ''
  79. PAPBLA = ''
  80. PAPRED = ''
  81. PAPGRE = ''
  82. PAPYEL = ''
  83. PAPBLU = ''
  84. PAPPUR = ''
  85. PAPCYA = ''
  86. PAPWHI = ''
  87.  
  88. yatzstart:
  89. if exists(file4) then do
  90. call open file, (file4), 'R'
  91. WHOON = readln(file)
  92. wholine=readln(file)
  93. call close file
  94. if wholine ~= linenumber then do
  95. string=cls
  96. call output
  97. string="   "papWHi""penRED"The Yahtzee game is currently being played by"off
  98. call output
  99. string="   "papgre||penRED""WHOON""papWHi""penRED" on another line."off
  100. call output
  101. string="   "papWHi""penRED"Try back in a little while..."off
  102. call output
  103. call blank
  104. string='Tap any key to continue....'
  105. call getkey
  106. sk=1;signal byebye
  107. end
  108. end
  109. call open last,(file5),'R';xx=readln(last);xx=upper(xx);call close last
  110. if xx=upper(handle) then do
  111. string=cls"Sorry, you were the last player.  Gotta let someone else play before you"
  112. call output
  113. string="can play again."
  114. call output
  115. string="Aren't you tired of playing yet anyway?"
  116. call output
  117. string="Press return"
  118. call getkey
  119. x=upper(hot)
  120. call blank
  121. sk=1;signal byebye
  122. end
  123. call open last,(file5),'W';call writeln last,handle;call close last
  124. call open "HI", (file1),'R'
  125. if ~exists(file1) then do
  126. call close "HI"
  127. call open "HI", (file1),'W'
  128. highscore=01
  129. do i = 1 to 10;highname.i="None yet";highscore.i=0
  130. sent = ''highname.i'|'highscore.i;call writeln "HI", sent;end
  131. call close "HI";end
  132. call open "ER", (file13),'R'
  133. if ~exists(file13) then do
  134. call open "ER", (file13),'W'
  135. sent = 'Yahtzee Error Log'
  136. call writeln "ER", sent;sent = '~~~~~~~~~~~~~~~~~~~~~~~';call writeln "ER", sent
  137. end;call close "ER"
  138.  
  139. TITLE:
  140. string=cls
  141. call msg
  142. call readgra doorname,linenumber,file2
  143. string=HOM||PENCYA"          "sysopname||PENGRE" and "PENYEL||bbsname||PENWHI" are proud to present"
  144. call output
  145. call open file, (file1),'R';string=HOM
  146. call output
  147. do i = 1 to 10;inn = readln(file);parse var inn highname.i '|' highscore.i
  148. string=PENRED""PAPWHI""5+i";41H"highname.i""PENPUR""5+i";64H"highscore.i
  149. call msg
  150. end;call close file
  151. string="40H"||PAPBLA""PENWHI
  152. call msg
  153. cmd = 'Z'
  154. do until ((upper(cmd) = 'I') | (upper(cmd) = 'G') | (upper(cmd) = 'Q'))
  155. string=""
  156. call getkey
  157. cmd = hot
  158. if ~exists(file4) then do;call open file, (file4), 'W';call writeln file, handle;call writeln file, linenumber;call close file;end
  159. end
  160. string=upper(cmd)
  161. call output
  162. if (upper(cmd)=='I') then do
  163. call readfile doorname,linenumber,file3
  164. string=PAPBLU""PENYEL"                          Press any key to continue!                           "PAPBLA""PENWHI
  165. call output
  166. string=""
  167. call getkey
  168. signal TITLE
  169. end
  170. if (upper(cmd)=='G') then do
  171. plays = plays + 1;if plays > maxplays then signal outofplays
  172. do nu=1 to 6;c.nu=0;end;BONUS=0;CK.3=0;CK.4=0;HOUSE=0;CHANCE = 0;SMALL=0;LARGE=0;YAHT=0
  173. do hy=1 to 12;YBON.hy=0;end;do re=1 to 6;s.re=0;y.re=0;end;sk.3=0;sk.4=0;shouse=0
  174. schance=0;sbonus=0;ssmall=0;slarge=0;syaht=0;do ty= 1 to 12;sybon.ty=0;end;goes=0
  175. call GAME
  176. end
  177. if (upper(cmd)=='Q') then do
  178. call blank
  179. call SHUTDOWN
  180. end
  181. signal getout
  182.  
  183. GAME:
  184. call carrier
  185. string=cLS||"H"||PENWHI""PAPBLU"                YAHTZEE "version" (c) 1993 by Cameron Arnott     Maxplays = "maxplays"      "
  186. call msg
  187. string="You have "maxplays-plays+1" plays left out of a possible "maxplays" turns.  Please press any key...     "
  188. call msg
  189. string=""
  190. call getkey
  191. string=cls||PAPWHI""PENGRE" ONES    "PENBLU"|    |    "PENPUR"Sum of ones      "PENGRE" YAHTZEE "PENBLU"|    |"PENGRE" 50  "PENPUR"eg:6 6 6 6 6           "
  192. call output
  193. string=PENGRE" TWOS    "PENBLU"|    |    "PENPUR"Sum of twos      "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 2nd YAHTZEE  "
  194. call output
  195. string=PENGRE" THREES  "PENBLU"|    |    "PENPUR"Sum of threes    "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 3rd YAHTZEE  "
  196. call output
  197. string=PENGRE" FOURS   "PENBLU"|    |    "PENPUR"Sum of fours     "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 4th YAHTZEE  "
  198. call output
  199. string=PENGRE" FIVES   "PENBLU"|    |    "PENPUR"Sum of fives     "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 5th YAHTZEE  "
  200. call output
  201. string=PENGRE" SIXES   "PENBLU"|    |    "PENPUR"Sum of sixes     "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 6th YAHTZEE  "
  202. call output
  203. string="         "PENBLU">----<                     "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 7th YAHTZEE  "
  204. call output
  205. string=PENGRE" SUB 1   "PENBLU"|    |    "PENPUR"Total of above   "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 8th YAHTZEE  "
  206. call output
  207. string=PENGRE" BONUS   "PENBLU"|    |"PENGRE" 35 "PENPUR"Bonus SUB 1 > 62 "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 9th YAHTZEE  "
  208. call output
  209. string=PENGRE"         "PENBLU">----<                     "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 10th YAHTZEE "
  210. call output
  211. string=PENGRE" SUB 2   "PENBLU"|    |    "PENPUR"SUB 1 + BONUS    "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 11th YAHTZEE "
  212. call output
  213. string=PENGRE"         "PENBLU">====<                     "PENGRE" Y/BONUS "PENBLU"|    |"PENGRE" 100 "PENPUR"Bonus for 12th YAHTZEE "
  214. call output
  215. string=PENGRE" 3 KIND  "PENBLU"|    |    "PENPUR"Sum of dice               "PENBLU">----<                            "
  216. call output
  217. string=PENGRE" 4 KIND  "PENBLU"|    |    "PENPUR"Sum of dice      "PENGRE"   SUB 3 "PENBLU"|    |     "PENPUR"Sub total since SUB 2  "
  218. call output
  219. string=PENGRE" F/HOUSE "PENBLU"|    |"PENGRE" 25 "PENPUR"eg:6 6 6 5 5     "PENGRE"   SUB 2 "PENBLU"|    |     "PENPUR"Brought accross        "
  220. call output
  221. string=PENGRE" SML STR "PENBLU"|    |"PENGRE" 30 "PENPUR"eg:1 2 3 4 6              "PENBLU">====<                            "
  222. call output
  223. string=PENGRE" LRG STR "PENBLU"|    |"PENGRE" 40 "PENPUR"eg:1 2 3 4 5  "PENGRE"GRAND TOTAL "PENBLU"<    >     "PENPUR"Total Score            "
  224. call output
  225. string=PENGRE" CHANCE  "PENBLU"|    |    "PENPUR"Sum of dice               "PENBLU">====<                            "
  226. call output
  227.  
  228. game2:
  229. string="3HD"PENRED||PAPWHI"   DIE 1    DIE 2    DIE 3    DIE 4    DIE 5      Total value of dice          "PAPBLA
  230. call output
  231. string=PAPWHI""PENBLA
  232. call msg
  233. sub1=0
  234. do gu=1 to 6;ug=gu
  235. if c.gu=1 & s.gu > 9 then do
  236.  string=""||ug||";13H"s.gu
  237.  call output
  238. end
  239. if c.gu=1 & s.gu < 10 then do
  240.  string=""||ug||";14H"s.gu
  241.  call output
  242. end
  243. sub1 = sub1+s.gu
  244. end
  245. if sub1 > 99 then do
  246.  string="2H"sub1
  247.  call output
  248. end
  249. if sub1 > 9  & sub1 < 100 then do
  250.  string="3H"sub1
  251.  call output
  252. end
  253. if sub1 < 10 then do
  254.  string="4H"sub1
  255.  call output
  256. end
  257. if sub1>62 then sbonus=35;BONUS=1
  258. if BONUS=1 & sbonus >9 then do
  259.  string="3H"sbonus
  260.  call output
  261. end
  262. if BONUS=1 & sbonus <10 then do
  263.  string="4H"sbonus
  264.  call output
  265. end
  266. sub2=sub1+sbonus
  267. if sub2 > 99 then do
  268.  string="12H"sub2
  269.  call output
  270. end
  271. if sub2 > 9 & sub2 <100 then do
  272.  string="13H"sub2
  273.  call output
  274. end
  275. if sub2 < 10 then do
  276.  string="14H"sub2
  277.  call output
  278. end
  279. if CK.3=1 then do
  280.  string="13H"sk.3
  281.  call output
  282. end
  283. if Ck.4=1 then do
  284.  string="13H"sk.4
  285.  call output
  286. end
  287. if HOUSE=1 then do
  288.  string="13H"shouse
  289.  call output
  290. end
  291. if SMALL=1 then do
  292.  string="13H"ssmall
  293.  call output
  294. end
  295. if LARGE=1 then do
  296.  string="13H"slarge
  297.  call output
  298. end
  299. if CHANCE=1 & schance > 9 then do
  300.  string="13H"schance
  301.  call output
  302. end
  303. if CHANCE=1 & schance < 10 then do
  304.  string="14H"schance
  305.  call output
  306. end
  307. if YAHT=1 then do
  308.  string="9H"syaht
  309.  call output
  310. end
  311. do fy=2 to 12
  312.  if YBON.fy=2 then do
  313.   string=""||fy+1||";48H"sybon.fy
  314.   call output
  315.  end
  316. end
  317. sub3 = sk.3 + sk.4 + shouse + ssmall + slarge + schance + syaht
  318. do fq=2 to 12
  319. sub3=sub3+sybon.fq
  320. end
  321. if sub3 > 999 then do
  322.  string="47H"sub3
  323.  call output
  324. end
  325. if sub3>99 & sub3<1000 then do
  326.  string="48H"sub3
  327.  call output
  328. end
  329. if sub3>9 & sub3<100 then do
  330.  string="49H"sub3
  331.  call output
  332. end
  333. if sub3<10 then do
  334.  string="50H"sub3
  335.  call output
  336. end
  337. if sub2>99 then do
  338.  string="48H"sub2
  339.  call output
  340. end
  341. if sub2>9 & sub2<100 then do
  342.  string="49H"sub2
  343.  call output
  344. end
  345. if sub2<10 then do
  346.  string="50H"sub2
  347.  call output
  348. end
  349. gtotal=sub2+sub3
  350. if gtotal>999 then do
  351.  string="47H"gtotal
  352.  call output
  353. end
  354. if gtotal>99 & gtotal<1000 then do
  355.  string="48H"gtotal
  356.  call output
  357. end
  358. if gtotal>9 & gtotal<100 then do
  359.  string="49H"gtotal
  360.  call output
  361. end
  362. if gtotal<10 then do
  363.  string="50H"gtotal
  364.  call output
  365. end
  366. string= "1H"PAPBLA
  367. call output
  368. roll = 0
  369. if rer=1 then do i= 1 to 5;t.i=0;end
  370. else do i= 1 to 5lt.i=1;end
  371. call carrier
  372. if goes = 13 then do
  373. string=cls
  374. call output
  375. string="20H"PENGRE""PAPBLA" Press any key to see if"
  376. call output
  377. string="20H"PENYEL" you have made it onto the"
  378. call output
  379. string="20H"PENPUR" High Scores list...."
  380. call output
  381. string="20H"PENGRE" With a score of... "gtotal
  382. call output
  383. string=""
  384. call getkey
  385. call HIGH
  386. end
  387. call CHOISE
  388. signal getout
  389.  
  390. THROW_DICE:
  391. do d = 1 to 5
  392. if t.d = 1 then    do
  393. throw = ((random(2,14)/2)%1)
  394. if throw = 0 then throw = 1
  395. if throw = 7 then throw = 6
  396. if rer=1 then throw=die.d
  397. die.d=throw
  398. end
  399. if t.d = 0 then do;throw=die.d;end
  400. if d = 1 then do;y_coord = 3;call PLOT_DIE;end
  401. if d = 2 then do;y_coord = 12;call PLOT_DIE;end
  402. if d = 3 then do;y_coord = 21;call PLOT_DIE;end
  403. if d = 4 then do;y_coord = 30;call PLOT_DIE;end
  404. if d = 5 then do;y_coord = 39;call PLOT_DIE;end
  405. end
  406. string="3H"PENRED""PAPWHI" DIE 1 12H DIE 2 21H DIE 3 30H DIE 4 39H DIE 5 "
  407. call output
  408. roll=roll+1;if rer=1 then roll=reroll
  409. t.1=0;t.2=0;t.3=0;t.4=0;t.5=0;tvalue = 0
  410. do a = 1 to 5;tvalue = tvalue + die.a;end
  411. string="72H"PENBLU""tvalue
  412. call output
  413. string="50H"PENGRE""PAPBLA" Dice after "roll" roll           "
  414. call output
  415. if roll >2 then do;lop=0;call SCORE;end
  416. if roll <3 then do
  417.  string="50H"PENYEL" Press 1-5 [R]edraw           "
  418.  call output
  419. end
  420. if roll <3 then do
  421.  string="49H"PENPUR" [S]core [D]ice [Q]uit      "
  422.  call output
  423. end
  424. return
  425.  
  426. PLOT_DIE:
  427. call carrier
  428. string= PENBLU""PAPCYA
  429. call msg
  430. if throw = 1 then do
  431.  string=""y_coord"H       "
  432.  call msg
  433.  string=""y_coord"H   o   "
  434.  call msg
  435.  string=""y_coord"H       "PAPBLA
  436.  call msg
  437. end
  438. if throw = 2 then do
  439.  string=""y_coord"H o     "
  440.  call msg
  441.  string=""y_coord"H       "
  442.  call msg
  443.  string=""y_coord"H     o "PAPBLA
  444.  call msg
  445. end
  446. if throw = 3 then do
  447.  string=""y_coord"H     o "
  448.  call msg
  449.  string=""y_coord"H   o   "
  450.  call msg
  451.  string=""y_coord"H o     "PAPBLA
  452.  call msg
  453. end
  454. if throw = 4 then do
  455.  string=""y_coord"H o   o "
  456.  call msg
  457.  string=""y_coord"H       "
  458.  call msg
  459.  string=""y_coord"H o   o "PAPBLA
  460.  call msg
  461. end
  462. if throw = 5 then do
  463.  string=""y_coord"H o   o "
  464.  call msg
  465.  string=""y_coord"H   o   "
  466.  call msg
  467.  string=""y_coord"H o   o "PAPBLA
  468.  call msg
  469. end
  470. if throw = 6 then do
  471.  string=""y_coord"H o   o "
  472.  call msg
  473.  string=""y_coord"H o   o "
  474.  call msg
  475.  string=""y_coord"H o   o "PAPBLA
  476.  call msg
  477. end
  478. return
  479.  
  480. CHOISE:
  481. sc=0
  482. if roll = 0 then do
  483. do count=1 to 5;t.count =1;end;call THROW_DICE;end
  484. if roll < 3 then do until ((upper(cmd) = 'S') | (upper(cmd) = 'Q') | (upper(cmd) = 'D') | (upper(cmd) = 'R') | (cmd = 1) | (cmd = 2) | (cmd = 3) | (cmd = 4) | (cmd = 5))
  485. string=""
  486. call getkey
  487. cmd = hot
  488. end
  489. if (upper(cmd)='S') then do;lop=0;call SCORE;end
  490. if (upper(cmd)='D') then do;rer=0;call THROW_DICE;end
  491. if (upper(cmd)='R') then do;rer=1;reroll=roll;signal GAME
  492. end
  493. if (upper(cmd)='Q') then call SHUTDOWN
  494. if (0<cmd & 6>cmd) then call HIGHLIGHT
  495. signal CHOISE
  496.  
  497. HIGHLIGHT:
  498. z=0
  499. do i=0 to 5
  500. if (i = cmd & z=0 & t.i=0) then do
  501. t.i= 1
  502. string=""3+((cmd-1)*9)"H"PENWHI""PAPRED" DIE "cmd" 1H"PAPBLA""PENWHI
  503. call output
  504. z=1
  505. end
  506. if (i = cmd & z=0 & t.i=1) then do
  507. t.i= 0
  508. string=""3+((cmd-1)*9)"H"PENRED""PAPWHI" DIE "cmd" 1H"PAPBLA""PENWHI
  509. call output
  510. z=1
  511. end
  512. end
  513. return
  514.  
  515. SCORE:
  516. ch=0
  517. do v = 1 to 5;sort.v=die.v;end;call SORT
  518. string="50H"PENYEL" Place it against-     "
  519. call output
  520. if ch=0 & YAHT=0 then do
  521. if die.1=die.2 & die.2=die.3 & die.3=die.4 & die.4=die.5 & YAHT=0 then do
  522. syaht=50;end
  523. else do;syaht=0;end
  524. string="50H"PENGRE"  YAHTZEE :- "syaht" Points.    "
  525. call output
  526. string="69H"PENRED"  {Y/N}"
  527. call output
  528. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  529. string=""
  530. call getkey
  531. cmd = hot
  532. end
  533. if(upper(cmd)=="Y") then do
  534. if die.1=die.2 & die.2=die.3 & die.3=die.4 & die.4=die.5 & YAHT=0 then do
  535. YAHT=1;ch=1;YBON.1=1;end
  536. else do;YAHT=1;ch=1;YBON.1=1;end
  537. goes=goes+1;call game2;end;end
  538. if die.1=die.2 & die.2=die.3 & die.3=die.4 & die.4=die.5 & YAHT=1 & ch=0 & lop=0 then do
  539. string="50H"PENGRE""PAPBLA"   YAHTZEE! :- 100 Points   "
  540. call output
  541. string="50H"PENYEL"    BONUS!                  "
  542. call output
  543. string="50H"PENPUR" Press any key to Continue. "
  544. call output
  545. do yb=1 to 12;by = yb+1
  546. if YBON.yb=1 & YBON.by=0 & ch=0 & lop=0 then do
  547. YBON.by=1;sybon.by=100;lop=1;ch=1;end;end
  548. string=""
  549. call getkey
  550. string="50H"PENYEL" Place it against-       "
  551. call output
  552. end
  553. ch=0
  554. if LARGE=0 & ch=0 & ((sort.1=1 & sort.2=2 & sort.3=3 & sort.4=4 & sort.5=5)|(sort.1=2 & sort.2=3 & sort.3=4 & sort.4=5 & sort.5=6)) then do
  555. string="47H"PENGRE"  Large Straight :- 40 Points.  "
  556. call output
  557. string="69H"PENRED"  {Y/N}"
  558. call output
  559. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  560. string=""
  561. call getkey
  562. cmd = hot
  563. end
  564. if(upper(cmd)=="Y") then do
  565. LARGE=1;slarge=40;ch=1;goes=goes+1;call game2;end;end
  566. else do
  567. if LARGE=0 & ch=0 then do
  568. string="47H"PENGRE"   Large Straight :- 0 Points.  "
  569. call output
  570. string="69H"PENRED"  {Y/N}"
  571. call output
  572. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  573. string=""
  574. call getkey
  575. cmd = hot
  576. end
  577. if(upper(cmd)=="Y") then do
  578. LARGE=1;slarge=0;ch=1;goes=goes+1;call game2;end;end;end
  579. if SMALL=0 & ch=0 & ((sort.2=sort.1+1 & sort.3=sort.2+1 & sort.4=sort.3+1)|(sort.3=sort.2+1 & sort.4=sort.3+1 & sort.5=sort.4+1)|(sort.3=sort.1+1 & sort.4=sort.3+1 & sort.5=sort.4+1)|(sort.2=sort.1+1 & sort.4=sort.2+1 & sort.5=sort.4+1)|(sort.2=sort.1+1 & sort.3=sort.2+1 & sort.5=sort.3+1)) then do
  580. string="47H"PENGRE"  Small Straight :- 30 Points.  "
  581. call output
  582. string="69H"PENRED"  {Y/N}"
  583. call output
  584. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  585. string=""
  586. call getkey
  587. cmd = hot
  588. end
  589. if(upper(cmd)=="Y") then do
  590. SMALL=1;ssmall=30;ch=1;goes=goes+1;call game2;end;end
  591. else do
  592. if SMALL=0 & ch=0  then do
  593. string="47H"PENGRE"  Small Straight :- 0 Points.   "
  594. call output
  595. string="69H"PENRED"  {Y/N}"
  596. call output
  597. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  598. string=""
  599. call getkey
  600. cmd = hot
  601. end
  602. if(upper(cmd)=="Y") then do
  603. SMALL=1;ssmall=0;ch=1;goes=goes+1;call game2;end;end;end
  604. num = sort.3;kl.num=0;do op= 1 to 5;if num = sort.op then kl.num=kl.num+1;end
  605. if CK.4=0 & ch=0 & ((sort.1=sort.2 & sort.2=sort.3 & sort.3=sort.4)|(sort.2=sort.3 & sort.3=sort.4 & sort.4=sort.5)) then do
  606. string="47H"PENGRE"   4 of a Kind :- "tvalue"          "
  607. call output
  608. string="69H"PENRED"  {Y/N}"
  609. call output
  610. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  611. string=""
  612. call getkey
  613. cmd = hot
  614. end
  615. if(upper(cmd)=="Y") then do
  616. CK.4=1;sk.4=tvalue;ch=1;goes=goes+1;call game2;end;end;else do
  617. if CK.4=0 & ch=0 then do
  618. string="47H"PENGRE"       4 of a Kind :- 0       "
  619. call output
  620. string="69H"PENRED"  {Y/N}"
  621. call output
  622. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  623. string=""
  624. call getkey
  625. cmd = hot
  626. end
  627. if(upper(cmd)=="Y") then do
  628. CK.4=1;sk.4=0;ch=1;goes=goes+1;call game2;end;end;end
  629. if HOUSE=0 & ch=0 & ((sort.1=sort.2 & sort.1=sort.3 & sort.4=sort.5)|(sort.1=sort.2 & sort.3=sort.4 & sort.3=sort.5)) then do
  630. string="47H"PENGRE"     Full House :- 25 Points    "
  631. call output
  632. string="69H"PENRED"  {Y/N}"
  633. call output
  634. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  635. string=""
  636. call getkey
  637. cmd = hot
  638. end
  639. if(upper(cmd)=="Y") then do
  640. HOUSE=1;shouse=25;ch=1;goes=goes+1;call game2;end;end;else do
  641. if HOUSE=0 & ch=0 then do
  642. string="47H"PENGRE"     Full House :- 0 Points     "
  643. call output
  644. string="69H"PENRED"  {Y/N}"
  645. call output
  646. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  647. string=""
  648. call getkey
  649. cmd = hot
  650. end
  651. if(upper(cmd)=="Y") then do
  652. HOUSE=1;shouse=0;ch=1;goes=goes+1;call game2;end;end;end
  653. if CK.3=0 & ch=0 & ((sort.1=sort.2 & sort.1=sort.3)|(sort.2=sort.3 & sort.2=sort.4)|(sort.3=sort.4 & sort.3=sort.5)) then do
  654. string="47H"PENGRE"       3 of a Kind :- "tvalue"      "
  655. call output
  656. string="69H"PENRED"  {Y/N}"
  657. call output
  658. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  659. string=""
  660. call getkey
  661. cmd = hot
  662. end
  663. if(upper(cmd)=="Y") then do
  664. CK.3=1;sk.3=tvalue;ch=1;goes=goes+1;call game2;end;end;else do
  665. if CK.3=0 & ch=0 then do
  666. string="47H"PENGRE"       3 of a Kind :- 0         "
  667. call output
  668. string="69H"PENRED"  {Y/N}"
  669. call output
  670. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  671. string=""
  672. call getkey
  673. cmd = hot
  674. end
  675. if(upper(cmd)=="Y") then do
  676. CK.3=1;sk.3=0;ch=1;goes=goes+1;call game2;end;end;end
  677. do t= 1 to 6;jl.t=0
  678. do t1= 1 to 5;if sort.t1 = t then do
  679. jl.t= jl.t + t;end;end
  680. if ch=0 & c.t=0 then do
  681. string="47H"PENGRE"    Number " t " :- " jl.t "         "
  682. call output
  683. string="69H"PENRED"  {Y/N}"
  684. call output
  685. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  686. string=""
  687. call getkey
  688. cmd = hot
  689. end
  690. if (upper(cmd)=='Y')then do
  691. ch=1;s.t=jl.t;c.t=1;goes=goes+1;call game2;end;end;end
  692. if (ch=0 & CHANCE=0) then do
  693. string="47H"PENGRE"        Chance :- "tvalue"          "
  694. call output
  695. string="69H"PENRED"  {Y/N}"
  696. call output
  697. do until ((upper(cmd) = 'Y') | (upper(cmd) = 'N'))
  698. string=""
  699. call getkey
  700. cmd = hot
  701. end
  702. if(upper(cmd)=="Y") then do
  703. ch=1;CHANCE=1;schance=tvalue;goes=goes+1;call game2;end;end;signal SCORE
  704.  
  705. SORT:
  706. flag=0
  707. do f=1 to 4;g=f+1;if sort.f > sort.g then do
  708. temp = sort.f;sort.f=sort.g;sort.g=temp;flag=1;end;end;if flag=1 then signal SORT
  709. return
  710.  
  711. HIGH:
  712. if highscore.10 > gtotal then do
  713.  string="Congratulations!  For getting on the high scores board, I'm awarding you an"
  714.  call output
  715.  string="extra 15 minutes online!"
  716.  call output
  717.  call blank
  718.  minutes=15
  719.  call addtime
  720. end
  721. highscore.11 = gtotal;highname.11 = Handle
  722. do hg = 1 to 10;do hk = hg + 1 to 11
  723. if highscore.hg < highscore.hk then do
  724. tempscore = highscore.hg;highscore.hg = highscore.hk;highscore.hk = tempscore
  725. tempname = highname.hg;highname.hg = highname.hk;highname.hk = tempname
  726. end;end;end
  727. call open "HI", (file1),'W'
  728. do i = 1 to 10;sent = ''highname.i'|'highscore.i;call writeln "HI", sent;end
  729. call close "HI";signal TITLE
  730. signal shutdown
  731.  
  732. SHUTDOWN:
  733. if exists(file4) then do
  734.  flnm=file4
  735.  call deletefile
  736. end
  737. signal byebye
  738.  
  739. outofplays:
  740. string=cls||pencya"Sorry, "pengre||handle||pencya", you are out of plays.  Try again later."
  741. call output
  742. call blank
  743. string="Note that someone else must play before you can play again."
  744. call output
  745. call blank
  746. string=pengre"Press any key..."
  747. call getkey
  748. signal shutdown
  749.  
  750. BYEBYE:
  751. if sk=0 then call makebul
  752. signal getout
  753.  
  754. makebul:
  755. spzz="                                        "
  756. call open "bulletin", (file99),'W'
  757. call writeln "bulletin", "                            Yahtzee Top Ten Scores"
  758. call writeln "bulletin", "                            _______ ___ ___ ______"
  759. call writeln "bulletin"," "
  760. call writeln "bulletin"," "
  761. do i = 1 to 9;x1=length(highname.i);spz=30-x1;sent = i||".  "||highname.i ||left(spzz,spz)||highscore.i
  762. call writeln "bulletin", sent;end;x1=length(highname.10);spz=30-x1
  763. sent = "10. "||highname.i ||left(spzz,spz)||highscore.i;call writeln "bulletin", sent
  764. call writeln "bulletin"," ";call writeln "bulletin","Lets see if you can get on the high scores list,"
  765. call writeln "bulletin","~v1.  Go to the DOORS menu now!";call writeln "bulletin","~vc"
  766. call close "bulletin";return
  767.  
  768. GETKEY:
  769. call hotkey doorname,linenumber,string
  770. hot=result
  771. call carrier
  772. return
  773.  
  774. OUTPUT:
  775. call message doorname,linenumber,string,1
  776. return
  777.  
  778. MSG:
  779. call message doorname,linenumber,string,0
  780. return
  781.  
  782. BLANK:
  783. string = " "
  784. call output
  785. return
  786.  
  787. GETOUT:
  788. string = "You've been using "||doorname||" by "||author||"."
  789. call output
  790. call blank
  791. string = "Thank you, "||username||", please press [RETURN] or [ENTER]."
  792. call getkey
  793. call blank
  794. call Exit_Door DoorName,LineNumber
  795. exit 0
  796.  
  797. ERROR:
  798. call Exit_Door DoorName,LineNumber
  799. exit 0
  800.  
  801. deletefile:
  802. address command "delete "flnm
  803. return
  804.  
  805. AddTime:
  806. call AddUserTime doorname,linenumber,minutes
  807. return
  808.  
  809. Carrier:
  810. call CDetect doorname,linenumber
  811. cd=upper(result)
  812. if cd="NO CARRIER!" then signal error
  813. return
  814.